<!DOCTYPE html>
<html lang="en" class="no-js">
  <head>
<meta charset="UTF-8">
<title>Djongo - MongoDB Django Hosting</title>
<meta name="description" content="Djongo is a smarter approach to database querying. It maps python objects to MongoDB documents. It is popularly referred to as an Object Document Mapper or ODM. It is an extension to the traditional Django object relational modeling framework. Use Django Admin to directly add and modify documents stored in MongoDB. Use other contrib modules such as Auth and Sessions without any changes.">
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="Djongomapper">
<meta property="og:title" content="Djongo">
<meta property="og:url" content="https://www.djongomapper.com/">
<meta property="og:description" content="Djongo is a smarter approach to database querying. It maps python objects to MongoDB documents. It is popularly referred to as an Object Document Mapper or ODM. It is an extension to the traditional Django object relational modeling framework. Use Django Admin to directly add and modify documents stored in MongoDB. Use other contrib modules such as Auth and Sessions without any changes.">
<link rel="canonical" href="https://www.djongomapper.com/">
<script type="application/ld+json">
  {
    "@context": "https://schema.org",

      "@type": "Organization",
      "name": "Doableware AB",
      "url": "https://www.djongomapper.com/",
      "logo": "/assets/images/djongo-symbol-small.png"
  }
</script>
<meta name="google-site-verification" content="tFNu7Nc9hzKF9v7f6kYaoMbBCNyGREchcKMVdxJuyJo"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
  document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
</script>
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css" as="style"
      onload="this.onload=null;this.rel='stylesheet'">
<noscript>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5/css/all.min.css">
</noscript>
<link rel="stylesheet" href="/assets/css/main.css">
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/custom.css">
<link rel="shortcut icon" href="/assets/images/favicon.ico">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script>
<script src="/assets/js/cookie-consent.js"></script>
<script>(function (w, d, s, l, i) {
  w[l] = w[l] || [];
  w[l].push({
    'gtm.start':
      new Date().getTime(), event: 'gtm.js'
  });
  var f = d.getElementsByTagName(s)[0],
    j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
  j.async = true;
  j.src =
    'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
  f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-T72KG6N');</script>
  </head>
  <body class="layout--splash l-pitch-page banner-page l-splash-full">
    <nav class="skip-links">
      <ul>
        <li><a href="#site-nav" class="screen-reader-shortcut">Skip to primary navigation</a></li>
        <li><a href="#main" class="screen-reader-shortcut">Skip to content</a></li>
        <li><a href="#footer" class="screen-reader-shortcut">Skip to footer</a></li>
      </ul>
    </nav>
    <div class="masthead">
  <div class="masthead__inner-wrap">
    <div class="masthead__menu">
      <nav id="site-nav" class="greedy-nav">
        <a class="site-logo" href="/"><img src="/assets/images/djongo-symbol-small.png" alt="Djongo"></a>
        <a class="site-title" href="/">
          Djongo
          <span class="site-subtitle">MongoDB Django Hosting</span>
        </a>
        <ul class="visible-links">
          <li class="masthead__menu-item">
            <a href="/get-started/">Docs</a>
          </li>
          <li class="masthead__menu-item">
            <a href="/djongocs/login/">DjongoCS</a>
          </li>
          <li class="masthead__menu-item">
            <a href="https://github.com/doableware/djongo">Source</a>
          </li>
        </ul>

        <button class="greedy-nav__toggle hidden" type="button">
          <span class="visually-hidden">Toggle Menu</span>
          <div class="navicon"></div>
        </button>
        <ul class="hidden-links hidden"></ul>
      </nav>
    </div>
  </div>
</div>
    <div class="initial-content">
<div class="page__hero--overlay"
  style="background-image: url('/assets/images/home/banner-rand-dark-many7.png');">
    <div class="wrapper">
      <h1 id="page-title" class="page__title" itemprop="headline">
          MongoDB Django App Hosting
      </h1>
      <p class="page__lead">Host Django Apps on a MongoDB database.</p>
        <p><a href="/djongocs/create-account/" class="btn btn--light-outline btn--large">Get Started</a></p>
    </div>
</div>
<div id="main" role="main">
  <article class="splash" itemscope itemtype="https://schema.org/CreativeWork">
    <meta itemprop="headline" content="Djongo">
    <section class="page__content" itemprop="text">
      <section class="pitch-content">
        <div class="feature__wrapper ">
  <div class="feature__item--center">
    <div class="archive__item">
      <div class="archive__item-body">
        <div class="archive__item-excerpt">
          <p>Django App Hosting for MongoDB and SQL Databases</p>
        </div>
      </div>
    </div>
  </div>
</div>
        <div class="feature__wrapper seamless">
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/query-green-own.png"
             alt="Simplify Query Creation">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">Simplify Query Creation</h2>
        <div class="archive__item-excerpt">
          <p>Writing query documents can get out of control. Djongo does the heavy lifting of creating query documents for you.</p>
        </div>
        <p><a id="btn-query"              href="#query-creation"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/noSql.png"
             alt="SQL &lt;&gt; No SQL">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">SQL &lt;=&gt; No SQL</h2>
        <div class="archive__item-excerpt">
          <p>Switch between MongoDB and other SQL databases. Limit the impact to your Models and business logic.</p>
        </div>
        <p><a id="btn-no-sql"              href="/integrating-django-with-mongodb/#how-it-works"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/security-green.png"
             alt="Security">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">Security</h2>
        <div class="archive__item-excerpt">
          <p>Directly saving raw <code>JSON</code> into the database is scary. Djongo secures and validates the <code>JSON</code> document before saving.</p>
        </div>
        <p><a id="btn-security"              href="#security-and-integrity-checks"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/support-new.png"
             alt="Support">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">Support</h2>
        <div class="archive__item-excerpt">
          <p>Phone, Chat and Email support. Including commercial licensing for enterprises.</p>
        </div>
        <p><a id="btn-support"              href="/support/"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/rapid.png"
             alt="Rapid Prototyping">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">Rapid Prototyping</h2>
        <div class="archive__item-excerpt">
          <p>Speed up development with schema free models. Enforce protection with evolution.</p>
        </div>
        <p><a id="btn-rapid-prototyping"              href="#rapid-prototyping"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
  <div class="feature__item">
    <div class="archive__item">
      <div class="archive__item-teaser">
        <img src="/assets/images/home/webpage.png"
             alt="Web Interface">
      </div>
      <div class="archive__item-body">
        <h2 class="archive__item-title">Web Interface</h2>
        <div class="archive__item-excerpt">
          <p>Access and modify MongoDB through the web browser.</p>
        </div>
        <p><a id="btn-webpage"              href="/integrating-django-with-mongodb/#use-django-admin-to-add-documents"
              class="btn btn--primary">
          More</a></p>
      </div>
    </div>
  </div>
</div>

      </section>
      <section class="pitch">
  <div class="pitch-content">
    <h2>Djongo</h2>
<p><img alt="Djongo" class="img-right sz-sm top-align" src="/assets/images/home/djongo-name-logo.png" />
Djongo is a unified approach to database interfacing. It is an extension to the traditional 
<a href="https://www.djangoproject.com/">Django ORM</a> framework. It maps python objects to MongoDB documents, a technique
popularly referred to as Object Document Mapping or ODM.</p>
<p>Constructing queries using Djongo is <strong>much easier</strong> compared to writing lengthy Pymongo query documents.
Storing raw <code>JSON</code> emitted by the frontend directly into the database is scary. Djongo ensures that 
<strong>only clean data</strong> gets through. </p>
<p><strong>You no longer</strong> need to use the shell to inspect your data. By using the <code>Admin</code> package, you can access and
modify data directly from the web browser.
 Djongo includes handy UI elements that help represent MongoDB documents on the browser. </p>
<p><a href="/djongocs/create-account">Get Djongo</a>&#8594;</p>
  </div>
</section>
<section class="pitch">
  <div class="pitch-content">
    <h2 id="security-and-integrity-checks">Security and Integrity Checks</h2>
<div class="language-python highlighter-rouge highlight code-left top-align"><pre><span></span><code><span class="k">def</span> <span class="nf">script_injection</span><span class="p">(</span><span class="n">value</span><span class="p">):</span>
  <span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">find</span><span class="p">(</span><span class="s1">&#39;&lt;script&gt;&#39;</span><span class="p">)</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">:</span>
    <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s1">&#39;Script injection in </span><span class="si">%(value)s</span><span class="s1">&#39;</span><span class="p">),</span>
                          <span class="n">params</span><span class="o">=</span><span class="p">{</span><span class="s1">&#39;value&#39;</span><span class="p">:</span> <span class="n">value</span><span class="p">})</span>

<span class="k">class</span> <span class="nc">Entry</span><span class="p">(</span><span class="n">models</span><span class="o">.</span><span class="n">Model</span><span class="p">):</span>
  <span class="n">homepage</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">URLField</span><span class="p">(</span><span class="n">validators</span><span class="o">=</span><span class="p">[</span><span class="n">URLValidator</span><span class="p">,</span>
                                         <span class="n">script_injection</span><span class="p">])</span>
</code></pre></div>

<p>Djongo performs <strong>checks on data fields</strong> before they are saved to the database. </p>
<p>Define <strong>custom validators</strong> or use builtin validators to check the data. Validation is triggered prior to writing to the database.</p>
<p>Running <strong>integrity checks</strong> and field value validators ensures protect from garbage data. </p>
  </div>
</section>
<section class="pitch">
  <div class="pitch-content">
    <h2 id="query-creation">Query Creation</h2>
<div class="pitch-query">
  <div class="fp-left pos-twice sz-hf">
    <h3>PyMongo</h3>
    <div class="code">
      <div class="language-python highlighter-rouge highlight sz-short"><pre><span></span><code><span class="bp">self</span><span class="o">.</span><span class="n">db</span><span class="p">[</span><span class="s1">&#39;entry&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">aggregate</span><span class="p">(</span>
  <span class="p">[{</span>
    <span class="s1">&#39;$match&#39;</span><span class="p">:</span> <span class="p">{</span>
      <span class="s1">&#39;author_id&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;$ne&#39;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
        <span class="s1">&#39;$exists&#39;</span><span class="p">:</span> <span class="kc">True</span>
       <span class="p">}</span>
     <span class="p">}</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$lookup&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;from&#39;</span><span class="p">:</span> <span class="s1">&#39;author&#39;</span><span class="p">,</span>
        <span class="s1">&#39;localField&#39;</span><span class="p">:</span> <span class="s1">&#39;author_id&#39;</span><span class="p">,</span>
        <span class="s1">&#39;foreignField&#39;</span><span class="p">:</span> <span class="s1">&#39;id&#39;</span><span class="p">,</span>
        <span class="s1">&#39;as&#39;</span><span class="p">:</span> <span class="s1">&#39;author&#39;</span>
      <span class="p">}</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$unwind&#39;</span><span class="p">:</span> <span class="s1">&#39;$author&#39;</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$lookup&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;from&#39;</span><span class="p">:</span> <span class="s1">&#39;blog&#39;</span><span class="p">,</span>
        <span class="s1">&#39;localField&#39;</span><span class="p">:</span> <span class="s1">&#39;blog_id&#39;</span><span class="p">,</span>
        <span class="s1">&#39;foreignField&#39;</span><span class="p">:</span> <span class="s1">&#39;id&#39;</span><span class="p">,</span>
        <span class="s1">&#39;as&#39;</span><span class="p">:</span> <span class="s1">&#39;blog&#39;</span>
      <span class="p">}</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$unwind&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;path&#39;</span><span class="p">:</span> <span class="s1">&#39;$blog&#39;</span><span class="p">,</span>
        <span class="s1">&#39;preserveNullAndEmptyArrays&#39;</span><span class="p">:</span> <span class="kc">True</span>
      <span class="p">}</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$addFields&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;blog&#39;</span><span class="p">:</span> <span class="p">{</span>
          <span class="s1">&#39;$ifNull&#39;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;$blog&#39;</span><span class="p">,</span> <span class="p">{</span>
            <span class="s1">&#39;id&#39;</span><span class="p">:</span> <span class="kc">None</span><span class="p">,</span>
            <span class="s1">&#39;title&#39;</span><span class="p">:</span> <span class="kc">None</span>
          <span class="p">}]</span>
        <span class="p">}</span>
      <span class="p">}</span>
    <span class="p">},</span>
    <span class="p">{</span>
      <span class="s1">&#39;$match&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;author.name&#39;</span><span class="p">:</span> <span class="p">{</span>
          <span class="s1">&#39;$eq&#39;</span><span class="p">:</span> <span class="s1">&#39;Paul&#39;</span>
        <span class="p">}</span>
      <span class="p">}</span>
    <span class="p">},</span> 
    <span class="p">{</span>
      <span class="s1">&#39;$project&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;id&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
        <span class="s1">&#39;blog_id&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
        <span class="s1">&#39;author_id&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
        <span class="s1">&#39;content&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
        <span class="s1">&#39;blog.id&#39;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
        <span class="s1">&#39;blog.title&#39;</span><span class="p">:</span> <span class="kc">True</span>
      <span class="p">}</span>
    <span class="p">}]</span>
</code></pre></div>
    </div>
  </div>
  <div class="fp-right pos-twice sz-hf">
    <h3>Djongo</h3>
    <div class="code">
      <div class="language-python highlighter-rouge highlight sz-short"><pre><span></span><code><span class="n">qs</span> <span class="o">=</span> <span class="n">Entry</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">author__name</span><span class="o">=</span><span class="s1">&#39;Paul&#39;</span><span class="p">)</span>\
                  <span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s1">&#39;blog&#39;</span><span class="p">)</span>
</code></pre></div>
    </div>
  </div>
</div>
<p>Djongo generates complex, error free, aggregation queries automatically.
It takes the relatively simple query on the right 
and <strong>automatically generates</strong> the pymongo query document on the left.</p>
  </div>
</section>
<section class="pitch">
  <div class="pitch-content">
    <h2 id="rapid-prototyping">Rapid Prototyping</h2>
<p><img alt="Djongo" class="img-right sz-sm" src="/assets/images/home/rapid-levels.png" />
As your data evolves you may wish to enforce a structure to it. The <code>JSONField</code> represents documents with no structure, and <strong>no validations</strong>. </p>
<p>The <code>EmbeddedField</code> lets you describe the structure which triggers automatic <strong>validations at the application level</strong>.</p>
<p>Setting <code>enforce_schema = True</code> in the <code>settings.py</code> file enables schema <strong>checks at the database level</strong>.</p>
<p><a href="/djongocs/create-account">Get rapid prototyping</a>&#8594;</p>
  </div>
</section>
<section class="pitch">
  <div class="pitch-content">
    <h2>Installation and Setup</h2>
<p>Download and install the latest version of Djongo by running:</p>
<div class="language-python highlighter-rouge highlight"><pre><span></span><code><span class="n">pip</span> <span class="n">install</span> <span class="n">djongo</span>
</code></pre></div>

<p>The project directory is where all Djongo settings live. Auto generate the required files by running:</p>
<div class="language-python highlighter-rouge highlight"><pre><span></span><code><span class="n">django</span><span class="o">-</span><span class="n">admin</span> <span class="n">startproject</span> <span class="n">mysite</span>
</code></pre></div>

<p>You can replace <em>mysite</em> with a name of your choosing.
Go into the root of <em>mysite</em> directory to find the <code>settings.py</code> file. Add:</p>
<div class="language-python highlighter-rouge highlight"><pre><span></span><code><span class="n">DATABASES</span> <span class="o">=</span> <span class="p">{</span>
    <span class="s1">&#39;default&#39;</span><span class="p">:</span> <span class="p">{</span>
        <span class="s1">&#39;ENGINE&#39;</span><span class="p">:</span> <span class="s1">&#39;djongo&#39;</span><span class="p">,</span>
        <span class="s1">&#39;NAME&#39;</span><span class="p">:</span> <span class="s1">&#39;your-db-name&#39;</span><span class="p">,</span>
    <span class="p">}</span>
<span class="p">}</span>
</code></pre></div>

<p>YOU ARE SET! Have fun!</p>
<p class="text-center"><a class="btn btn--primary btn--large" href="/djongocs/create-account">Get Started</a></p>
  </div>
</section>

    </section>
  </article>
</div>
    </div>
    <div id="footer" class="page__footer">
  <footer>
    <aside class="l-fixed-notice cookie-notice">
  <p>We use cookies to enhance user experience. You consent to their usage by browsing this site. <button id="cookie-accept" class="btn btn--success">Accept</button></p>
</aside>
    <div class="page__footer-copyright">&copy; 2022 Doableware AB.</div>
  </footer>
</div>
<script src="/assets/js/main.min.js"></script>
<script>
  window.ga = function () {
    ga.q.push(arguments)
  };
  ga.q = [];
  ga.l = +new Date;
  ga('create', 'UA-75159067-1', 'auto');
  ga('set', 'anonymizeIp', false);
  ga('send', 'pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async></script>
  </body>
</html>